TYPE=VIEW
query=select `s`.`ID` AS `ID`,(select count(0) AS `COUNT(*)` from `hrms`.`paymentitem` where ((`hrms`.`paymentitem`.`GRADE` = (select `hrms`.`student`.`ADMISSION_YEAR` AS `ADMISSION_YEAR` from `hrms`.`student` where (`hrms`.`student`.`ID` = `s`.`ID`))) and ((`hrms`.`paymentitem`.`SPECIALITY_ID` = 1) or `hrms`.`paymentitem`.`SPECIALITY_ID` in (select `spe`.`ID` AS `ID` from `hrms`.`speciality` `spe` join `hrms`.`theclass` `c` join `hrms`.`student` `s` where ((`spe`.`ID` = `c`.`SPECIALITY_ID`) and (`c`.`ID` = `s`.`CLASS_ID`)))) and (not(`hrms`.`paymentitem`.`ID` in (select `hrms`.`payment`.`PAYMENTITEM_ID` AS `PAYMENTITEM_ID` from `hrms`.`payment` where (`hrms`.`payment`.`STUDENT_ID` = `s`.`ID`)))))) AS `UNPAID_COUNT` from `hrms`.`student` `s`
md5=b20f95e4a89a4d86a6ec3fb405bc0561
updatable=0
algorithm=0
definer_user=root
definer_host=localhost
suid=2
with_check_option=0
timestamp=2010-02-25 07:35:29
create-version=1
source=SELECT ID, \n		(SELECT COUNT(*) \n		FROM PAYMENTITEM\n		WHERE 			\n			GRADE=(SELECT ADMISSION_YEAR FROM STUDENT WHERE ID=S.ID)\n			AND\n			(\n			SPECIALITY_ID = 1 OR \n			SPECIALITY_ID IN \n				(SELECT SPE.ID FROM SPECIALITY SPE, THECLASS C, STUDENT S \n					WHERE SPE.ID=C.SPECIALITY_ID AND C.ID=S.CLASS_ID) \n			)\n				AND ID NOT IN\n				(\n					SELECT PAYMENTITEM_ID FROM PAYMENT \n					WHERE STUDENT_ID = s.ID\n				)) AS UNPAID_COUNT\n	FROM STUDENT S
client_cs_name=gbk
connection_cl_name=gbk_chinese_ci
view_body_utf8=select `s`.`ID` AS `ID`,(select count(0) AS `COUNT(*)` from `hrms`.`paymentitem` where ((`hrms`.`paymentitem`.`GRADE` = (select `hrms`.`student`.`ADMISSION_YEAR` AS `ADMISSION_YEAR` from `hrms`.`student` where (`hrms`.`student`.`ID` = `s`.`ID`))) and ((`hrms`.`paymentitem`.`SPECIALITY_ID` = 1) or `hrms`.`paymentitem`.`SPECIALITY_ID` in (select `spe`.`ID` AS `ID` from `hrms`.`speciality` `spe` join `hrms`.`theclass` `c` join `hrms`.`student` `s` where ((`spe`.`ID` = `c`.`SPECIALITY_ID`) and (`c`.`ID` = `s`.`CLASS_ID`)))) and (not(`hrms`.`paymentitem`.`ID` in (select `hrms`.`payment`.`PAYMENTITEM_ID` AS `PAYMENTITEM_ID` from `hrms`.`payment` where (`hrms`.`payment`.`STUDENT_ID` = `s`.`ID`)))))) AS `UNPAID_COUNT` from `hrms`.`student` `s`
